
function showMap(zoom) {
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("mapsearch"));
		form = document.forms[0];
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(-12.092702, -77.063255), zoom);
	} else {
		alert("Sorry, the Google Maps API is not compatible with this browser");
	}
	return map;
}
function registrarMouseClickListener() {
	GEvent.addListener(map, "click", function (markerMap, pointMap) {
		if (pointMap) {
			form.cadenaPuntos.value = pointMap.lat() + " " + pointMap.lng();
//			alert(form.cadenaPuntos.value);
		}
	});
}
function CopSoftware() {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("mapsearch"),{draggableCursor: 'crosshair'});
		form = document.forms[0];
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(-12.092702, -77.063255), 14);
		var point = eval("new GLatLng(-12.092702,-77.063255)");
		map.addOverlay(new GMarker(point));
		GEvent.addListener(map, "click", function (markerMap, pointMap) {
			if (pointMap) {
				alert("Evento En Mapa: Latitud:" + pointMap.lat() + " Longitud:" + pointMap.lng());
				form.cadenaPuntos.value = form.cadenaPuntos.value + "," + pointMap.lat() + " " + pointMap.lng();
				alert(form.cadenaPuntos.value);
			}
		});
	
	      // ================================================================
      // === Define the function thats going to process the JSON file ===
		process_it = function (doc) {
        // === Parse the JSON document === 
			var jsonData = eval("(" + doc + ")");        
        // === Plot the polylines ===
			/*        alert("Stroke Color: "+jsonData.lines[0].strokeColor);
        alert("Stroke Weigth: "+jsonData.lines[0].strokeWeight);
        alert("Stroke Opacity: "+jsonData.lines[0].strokeOpacity);                
        alert("Fill Color: "+jsonData.lines[0].fillColor);          
        alert("Fill Opacity: "+jsonData.lines[0].fillOpacity);*/
			var polygon = new GPolygon(jsonData.lines[0].points, jsonData.lines[0].strokeColor, jsonData.lines[0].strokeWeight, jsonData.lines[0].strokeOpacity, jsonData.lines[0].fillColor, jsonData.lines[0].fillOpacity, {clickable:false});
			map.addOverlay(polygon);
			/*		GEvent.addListener(polygon, "click", function(markerPoly, pointPoly) {
			alert("Evento En Poligono: Latitud:"+pointPoly.lat()+" Longitud:"+ pointPoly.lng());
			listaPuntos=listaPuntos+","+pointPoly.lat()+" "+pointPoly.lng();
		});           */
		};          
//
//      // ================================================================
//      // === Fetch the JSON data file ====    
		GDownloadUrl("/CSWeb/modules/comun/json/jurisdiccion.json", process_it);
      // ================================================================

    // display a warning if the browser was not compatible
	} else {
		alert("Sorry, the Google Maps API is not compatible with this browser");
	}
}

